-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(subscribe): Deprecate null starting parameter signatures for subscribe #4202
Conversation
Pull Request Test Coverage Report for Build 7307
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the initiative on this.
src/internal/Observable.ts
Outdated
@@ -70,6 +70,12 @@ export class Observable<T> implements Subscribable<T> { | |||
} | |||
|
|||
subscribe(observer?: PartialObserver<T>): Subscription; | |||
/** @deprecated */ | |||
subscribe(next: null, error: null, complete: () => void): Subscription; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think undefined
would be the way to go - rather than null
.
At the moment, it's not possible to call subscribe
and pass null
as an argument without TypeScript complaining, so unless the existing, non-deprecated signatures are altered to accept null
arguments, I think the deprecations will be largely ineffectual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There'd be no harm in using null | undefined
, though.
By the way, as part of my additional fixup for this it may make sense to have a specific deprecation message. Do we have copy in mind that we want to add? |
I'm actually thinking about that right now, as I'm writing a TSLint rule to do the same. I'll let you know what I come up with. |
Regarding the coveralls failure. It seems to report +/-0.2% changes in a seemingly non-deterministic way. I was speaking to someone on Monday, at a meetup, and he was of the opinion that it was due to the PR's branch not being completely up-to-date with As an experiment, could you ensure your
I'd be really interested in whether or not coveralls passes after that. This +/-0.2% variation has been an annoyance for a long time. |
regarding above, I'm curious if generated coverage have problem or the way coveralls translate it have some problems. ..brutal way, maybe we can setup codecov also and 1:1 compare for a while per each PRs? |
@kwonoj I don't really know enough about Coveralls or what it's doing. I mentioned the problem during a talk (on contributing to OSS) and someone came up to tell me about his experiences, afterwards. If we can establish what the problem is, we might be able to get a decent solution. ATM, if you cannot reliably see whether the coverage goes up or down, it's not especially useful. TBH, though, I'm not super keen on getting into the coveralls nitty gritty. 😬 |
I am usually just ignoring those minor deets, so on same boat. Only reason I care is most new contributor got highly confused like 'I only changed doc and coverage dropped, maybe I did something wrong'. |
@ajcrites I'd suggest something like: /** @deprecated Use an observer instead of an error callback */ And would tailor the message to whichever function the deprecation applies. |
We're in the midst of updating the terminology "observer" to "subscriber," at least in some documentation. Should I stick with "observer" for this? |
Sorry about the closure. On mobile with fat fingers. My understanding is that the documentation is changing re: |
@ajcrites BTW, you can disregard my request to experiment with rebasing your PR. I've grabbed a copy of your branch and I'm going to do some experimentation of my own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@ajcrites ... subscribe accepts a |
Description:
Per discussion on #4159, this deprecates the signatures for
.subscribe
and.tap
that are(null, null, complete)
,(null, error, complete)
, and(next, null, complete)
.Related issue (if exists):
#4159